#pragma once

#ifndef __XINPUT_GAMEPAD_BUTTON_CONSTANTS_H__
#define __XINPUT_GAMEPAD_BUTTON_CONSTANTS_H__

//  Library Includes

//  Local Includes
#include <XInput.h>

//  Types
typedef enum
{
	eXINPUT_GAMEPAD_FLOOR = -1,

	eXINPUT_GAMEPAD_DPAD_UP,          
	eXINPUT_GAMEPAD_DPAD_DOWN,        
	eXINPUT_GAMEPAD_DPAD_LEFT,        
	eXINPUT_GAMEPAD_DPAD_RIGHT,       
	eXINPUT_GAMEPAD_START,            
	eXINPUT_GAMEPAD_BACK,                 
	eXINPUT_GAMEPAD_LEFT_SHOULDER,    
	eXINPUT_GAMEPAD_RIGHT_SHOULDER,   
	eXINPUT_GAMEPAD_A,                
	eXINPUT_GAMEPAD_B,                
	eXINPUT_GAMEPAD_X,                
	eXINPUT_GAMEPAD_Y,                

	eXINPUT_GAMEPAD_CEIL

} eXInputGamepadButton;

typedef enum
{
	eXINPUT_BATTERY_TYPE_FLOOR = -1,

	eXINPUT_BATTERY_TYPE_DISCONNECTED,
	eXINPUT_BATTERY_TYPE_WIRED,
	eXINPUT_BATTERY_TYPE_ALKALINE,
	eXINPUT_BATTERY_TYPE_NIMH,
	eXINPUT_BATTERY_TYPE_UNKNOWN,

	eXINPUT_BATTERY_TYPE_CEIL

} eXInputBatteryType;

typedef enum
{
	eXINPUT_BATTERY_LEVEL_FLOOR = -1,

	eXINPUT_BATTERY_LEVEL_EMPTY,
	eXINPUT_BATTERY_LEVEL_LOW,
	eXINPUT_BATTERY_LEVEL_MEDIUM,
	eXINPUT_BATTERY_LEVEL_HIGH,
	eXINPUT_BATTERY_LEVEL_FULL,

	eXINPUT_BATTERY_LEVEL_CEIL

} eXInputBatteryLevel;

//  Constants

//  Prototypes

//  Forward Declarations

WORD GetXInputConstants( const eXInputGamepadButton _eButton )
{
	if( _eButton == eXINPUT_GAMEPAD_DPAD_UP )
		return XINPUT_GAMEPAD_DPAD_UP;

	if( _eButton == eXINPUT_GAMEPAD_DPAD_DOWN )
		return XINPUT_GAMEPAD_DPAD_DOWN;

	if( _eButton == eXINPUT_GAMEPAD_DPAD_LEFT )
		return XINPUT_GAMEPAD_DPAD_LEFT;

	if( _eButton == eXINPUT_GAMEPAD_DPAD_RIGHT )
		return XINPUT_GAMEPAD_DPAD_RIGHT;

	if( _eButton == eXINPUT_GAMEPAD_START )
		return XINPUT_GAMEPAD_START;

	if( _eButton == eXINPUT_GAMEPAD_BACK )
		return XINPUT_GAMEPAD_BACK;

	if( _eButton == eXINPUT_GAMEPAD_LEFT_SHOULDER )
		return XINPUT_GAMEPAD_LEFT_SHOULDER;

	if( _eButton == eXINPUT_GAMEPAD_RIGHT_SHOULDER )
		return XINPUT_GAMEPAD_RIGHT_SHOULDER;

	if( _eButton == eXINPUT_GAMEPAD_A )
		return XINPUT_GAMEPAD_A;

	if( _eButton == eXINPUT_GAMEPAD_B )
		return XINPUT_GAMEPAD_B;

	if( _eButton == eXINPUT_GAMEPAD_X )
		return XINPUT_GAMEPAD_X;

	if( _eButton == eXINPUT_GAMEPAD_Y )
		return XINPUT_GAMEPAD_Y;

	return 0;
}

eXInputGamepadButton GetXInputEnums( const WORD _wButton )
{
	if( _wButton == XINPUT_GAMEPAD_DPAD_UP )
		return eXINPUT_GAMEPAD_DPAD_UP;

	if( _wButton == XINPUT_GAMEPAD_DPAD_DOWN )
		return eXINPUT_GAMEPAD_DPAD_DOWN;

	if( _wButton == XINPUT_GAMEPAD_DPAD_LEFT )
		return eXINPUT_GAMEPAD_DPAD_LEFT;

	if( _wButton == XINPUT_GAMEPAD_DPAD_RIGHT )
		return eXINPUT_GAMEPAD_DPAD_RIGHT;

	if( _wButton == XINPUT_GAMEPAD_START )
		return eXINPUT_GAMEPAD_START;

	if( _wButton == XINPUT_GAMEPAD_BACK )
		return eXINPUT_GAMEPAD_BACK;

	if( _wButton == XINPUT_GAMEPAD_LEFT_SHOULDER )
		return eXINPUT_GAMEPAD_LEFT_SHOULDER;

	if( _wButton == XINPUT_GAMEPAD_RIGHT_SHOULDER )
		return eXINPUT_GAMEPAD_RIGHT_SHOULDER;

	if( _wButton == XINPUT_GAMEPAD_A )
		return eXINPUT_GAMEPAD_A;

	if( _wButton == XINPUT_GAMEPAD_B )
		return eXINPUT_GAMEPAD_B;

	if( _wButton == XINPUT_GAMEPAD_X )
		return eXINPUT_GAMEPAD_X;

	if( _wButton == XINPUT_GAMEPAD_Y )
		return eXINPUT_GAMEPAD_Y;

	return eXINPUT_GAMEPAD_CEIL;
}

#endif // __XINPUT_GAMEPAD_BUTTON_CONSTANTS_H__
